package com.nulstudio.sppm.Service;

import com.nulstudio.sppm.Dao.CommodityMapper;
import com.nulstudio.sppm.Dao.SupplierMapper;
import com.nulstudio.sppm.Entities.Commodity;
import com.nulstudio.sppm.Entities.SupplierInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommodityService {
    @Autowired
    private CommodityMapper CommodityMapper;

    public List<Commodity> getAllCommodities() {
        return CommodityMapper.getAllCommodities();
    }

    public int addCommodity(Commodity Commodity) {
        return CommodityMapper.addCommodity(Commodity);
    }

    public int modifyCommodity(Commodity Commodity) {
        return CommodityMapper.modifyCommodity(Commodity);
    }

    public int getIdByInfo(Commodity request) {
        return CommodityMapper.getIdByInfo(request);
    }

    public int getLastId() {
        return CommodityMapper.getLastId();
    }
    public int deleteCommodity(String id){return CommodityMapper.deleteCommodity(Integer.parseInt(id));}


}
